import java.util.Arrays;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-12
 */
public class Main {
/*    public static String test(int[] tmp){
        assert tmp == null;
*//*        if (tmp == null){
            return "null";
        }*//*
        return "ret";
    }
    public static void main(String[] args) {
        int[] array = null;
        System.out.println(test(array));
    }*/

    public static void main2(String[] args){
        int[] array = {1,2,3,4,5};
        char[] array6 = {'a','b','c'};
        int[] array2 = array.clone();
        char[] array3 = Arrays.copyOf(array6, array6.length);
        int[] array4 = new int[array.length];
        System.arraycopy(array, 0, array4, 0, array.length);
        System.out.println(Arrays.toString(array));
        array[2] = 99;
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array2));
        System.out.println(Arrays.toString(array3));
        System.out.println(Arrays.toString(array4));


    }

    public static int binarySearch(int[] array, int pos){
        int left = 0;
        int right = array.length - 1;
        while (left <= right){
            int mid = (left + right) >>> 1;
            if (pos < array[mid]){
                right = mid - 1;
            }else if (pos > array[mid]){
                left = mid + 1;
            }else{
                return mid;
            }
        }
        return -1;
    }
    public static void main1(String[] args) {
        int[] array = {1,2,3,4,5};
        System.out.println(binarySearch(array,5));
    }

    public static void main3(String[] args) {
        int[][] array = {{1,2,3},{4,5,6},{7,8,9}};

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }

        System.out.println(Arrays.deepToString(array));

        for (int[] tmp : array){
            for (int x : tmp){
                System.out.print(x + " ");
            }
            System.out.println();
        }

        int[][] array2 = new int[3][];
        array2[0] = new int[]{1};
        array2[1] = new int[]{2,3};
        array2[2] = new int[]{4,5,6};
        System.out.println(Arrays.deepToString(array2));

    }

    public static void transform(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] *= 2;
        }
    }

    public static void func(int[] array){
        int left = 0;
        int right = array.length - 1;
        while (left < right){
            //走到偶数位停下
            while (left < right && array[left] % 2 != 0){
                left++;
            }
            //走到奇数位停下
            while (left < right && array[right] % 2 == 0){
                right--;
            }
            //交换
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
    }

    public static int dog(int[] array){
        int sum = 0;
        for (int x : array){
            sum ^= x;
        }
        return sum;
    }
    public static int func2(int[] array){
        int ret = array[0];
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] == ret){
                count++;
            }else{
                count--;
            }

            if (count == 0){
                ret = array[i+1];
            }
        }
        return ret;
    }

    public static boolean func3(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 != 0){
                count++;
                if (count == 3){
                    return true;
                }
            }else{
                count = 0;
            }
        }
        return false;
    }

    public static void main2(String[] args) {
        int[] array = {4,1,5,3,4,4,4};
        boolean ret = func3(array);
        //System.out.println(Arrays.toString(array));
        System.out.println(ret);
    }

    public static void main(String[] args) {
        int[] arr = new int[3];
        //arr = {1,2,4};
        char a = '你';
        char[] b = {'a','b'};
    }
}
